#region Using

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;
using Agresso.Interface.Layer.Domain;

#endregion

namespace Agresso.Interface.Layer.Web
{
    public partial class MainForm : Form
    {
        UserControlLogin m_loginForm;
        User m_user;
        UserControlFactory m_userControlFactory;

        public MainForm()
        {
            InitializeComponent();
            ShowMainFormPanel(false);
            initLoginForm();            
            initTreeNodeAferSelect();

            treeNodeCommissionManagersMapping.Visible = false;
            treeNodeVessel.Visible = false;
            treeNodeVoyageCargoRelat.Visible = false;
            treeNodeConfiguration.Visible = false;
        }

        private void initTreeNodeAferSelect()
        {
            treeNodeAdmin.AfterSelect += new TreeViewEventHandler(treeNodeAdmin_AfterSelect);
            treeNodeUser.AfterSelect += new TreeViewEventHandler(treeNodeUser_AfterSelect);
            treeNodeUserRole.AfterSelect += new TreeViewEventHandler(treeNodeUserRole_AfterSelect);
            treeNodeConfiguration.AfterSelect+=new TreeViewEventHandler(treeNodeConfiguration_AfterSelect);
            treeNodeSchedulerTask.AfterSelect += new TreeViewEventHandler(treeNodeSchedulerTask_AfterSelect);
            treeNodeSoftmar.AfterSelect += new TreeViewEventHandler(treeNodeSoftmar_AfterSelect);
            treeNodeTCRElet.AfterSelect += new TreeViewEventHandler(treeNodeTCRElet_AfterSelect);
            treeNodeVessel.AfterSelect += new TreeViewEventHandler(treeNodeVessel_AfterSelect);
            treeNodeVoyageCargoRelat.AfterSelect += new TreeViewEventHandler(treeNodeVoyageCargoRelat_AfterSelect);
            treeNodeFreightHire.AfterSelect += new TreeViewEventHandler(treeNodeFreightHire_AfterSelect);
            treeNodeStatement.AfterSelect += new TreeViewEventHandler(treeNodeStatement_AfterSelect);
            treeNodeMappingMaster.AfterSelect += new TreeViewEventHandler(treeNodeMappingMaster_AfterSelect);
            treeNodeSoftmarVesselMapping.AfterSelect += new TreeViewEventHandler(treeNodeSoftmarVesselMapping_AfterSelect);
            treeNodeSoftmarProfitCentreMapping.AfterSelect += new TreeViewEventHandler(treeNodeSoftmarProfitCentreMapping_AfterSelect);
            treeNodeSupplierCustomerMapping.AfterSelect += new TreeViewEventHandler(treeNodeSupplierCustomerMapping_AfterSelect);
            treeNodeChergeTypeAccountMapping.AfterSelect += new TreeViewEventHandler(treeNodeChergeTypeAccountMapping_AfterSelect);
            treeNodeGradeAccountMapping.AfterSelect += new TreeViewEventHandler(treeNodeGradeAccountMapping_AfterSelect);
            treeNodeBunkerProcurementPO.AfterSelect += new TreeViewEventHandler(treeNodeBunkerProcurementPO_AfterSelect);
            treeNodeBunkerInventory.AfterSelect += new TreeViewEventHandler(treeNodeBunkerInventory_AfterSelect);
            treeNodeBunkerGRN.AfterSelect += new TreeViewEventHandler(treeNodeBunkerGRN_AfterSelect);
            treeNodeCommissionManagersMapping.AfterSelect += new TreeViewEventHandler(treeNodeCommissionManagersMapping_AfterSelect);

            treeNodeWinSDSPOError.AfterSelect += new TreeViewEventHandler(treeNodeWinSDSPOError_AfterSelect);
            treeNodeWinSDSPOView.AfterSelect += new TreeViewEventHandler(treeNodeWinSDSPOView_AfterSelect);

            treeNodeVoyageMaster.AfterSelect += new TreeViewEventHandler(treeNodeVoyageMaster_AfterSelect);
            treeNodeWinSDS.AfterSelect += new TreeViewEventHandler(treeNodeWinSDS_AfterSelect);
            treeNodeWinSDSPO.AfterSelect += new TreeViewEventHandler(treeNodeWinSDSPO_AfterSelect);
            treeNodeWinSDSGRN.AfterSelect += new TreeViewEventHandler(treeNodeWinSDSGRN_AfterSelect);
            treeNodeWinSDSProductMapping.AfterSelect += new TreeViewEventHandler(treeNodeWinSDSProductMapping_AfterSelect);

            treeNodeDaDeskVessel.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskVessel_AfterSelect);
            treeNodeDaDeskAgent.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskAgent_AfterSelect);
            treeNodeDaDeskCompany.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskCompany_AfterSelect);
            treeNodeDaDeskBank.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskBank_AfterSelect);
            treeNodeDaDeskAccount.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskAccount_AfterSelect);
            treeNodeDaDeskPort.AfterSelect += new TreeViewEventHandler(treeNodeDaDeskPort_AfterSelect);
            treeNodeResponsibleUserMapping.AfterSelect += new TreeViewEventHandler(treeNodeResponsibleUserMapping_AfterSelect);

            treeNodeBunkerInventoryManagerMapping.AfterSelect += new TreeViewEventHandler(treeNodeBunkerInventoryManagerMapping_AfterSelect);
            treeNodeProforma.AfterSelect += new TreeViewEventHandler(treeNodeProforma_AfterSelect);

            treeNodeCrewPayroll.AfterSelect += new TreeViewEventHandler(treeNodeCrewPayroll_AfterSelect);

            //treeNodeWinSDSPOView.Visible = m_user.AdminAccess;
        }

        void treeNodeDaDeskPort_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_PORT);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeDaDeskAccount_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_ACCOUNT);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDSProductMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS_PURCHASE_ORDER_PRODUCT_ACC_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeCrewPayroll_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.COMPASS_CREW_PAYROLL);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeProforma_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_PROFORMA_INVOICE);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeBunkerInventoryManagerMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_BUNKER_INVENTORY_MGR_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeResponsibleUserMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_RESPONSIBLE_USER_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeBunkerGRN_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_BUNKER_GRN);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeBunkerInventory_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_BUNKER_INVENTORY);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeStatement_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_STATEMENT);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeDaDeskBank_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_BANK);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeDaDeskCompany_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_COMPANY);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeDaDeskAgent_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_AGENT);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeDaDeskVessel_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.DADESK_VESSEL);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDSGRN_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS_GRN);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDSPO_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS_PURCHASE_ORDER);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDS_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeVoyageMaster_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_VOYAGE_MASTER);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDSPOView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS_PURCHASE_ORDER_VIEW);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeWinSDSPOError_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.WINSDS_PURCHASE_ORDER_ERROR);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeCommissionManagersMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_COMMISSION_MANAGERS_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeBunkerProcurementPO_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_BUNKER_PROCUREMENT_PO);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeSchedulerTask_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SCHEDULE_TASK);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeGradeAccountMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_GRADE_ACCOUNT_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeChergeTypeAccountMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_CHARGE_TYPE_ACCOUNT_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeSupplierCustomerMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_SUPPLIER_CUSTOMER_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeSoftmarProfitCentreMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_PROFITCENTRE_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeMappingMaster_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.ADMIN_MAPPING_MASTER);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeSoftmarVesselMapping_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_VESSEL_MAPPING);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeFreightHire_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_FREIGHTHIREINVOICE);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeVoyageCargoRelat_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_VOYAGECARGORELET);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeVessel_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_VESSEL);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }      
        }

        void treeNodeAdmin_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.ADMIN);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        public TreeView GetMainMenuTreeView()
        {
            
            return treeViewMenu;
        }

        void treeNodeTCRElet_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR_TCRELET);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeSoftmar_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.SOFTMAR);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeConfiguration_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.CONFIGURATION);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeUserRole_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.USER_ROLE);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        void treeNodeUser_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                loadUserControl(UserControlFactory.USER);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.Message, "Error Exception", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }

        private void loadUserControl(string p)
        {
            splitContainer1.Panel2.Controls.Clear();
            m_userControlFactory.GetUserControl(p).Dock = DockStyle.Fill;
            splitContainer1.Panel2.Controls.Add(m_userControlFactory.GetUserControl(p));
        }

        private void initLoginForm()
        {
            try
            {
                m_loginForm = new UserControlLogin(this);
                m_loginForm.Dock = DockStyle.Fill;
                this.Controls.Add(m_loginForm);
            }
            catch (Exception x)
            {
                throw x;
            }
        }
        public void ShowMainFormPanel(bool show)
        {
            panelMainForm.Visible = show;
        }
        public User User
        {
            get { return m_user; }
            set
            { 
                m_user = value;
                if (m_user.PasswordExpired && m_user.ExpiryDate.Subtract(DateTime.Now).Days < 7)
                {
                    MessageBox.Show("Your password will expiry within " + m_user.ExpiryDate.Date.Subtract(DateTime.Today).Days + " days.", "Password Expiration", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                }
                m_user.SESSION_ID = this.Session.SessionID;
                textBoxUserName.Text = m_user.UserName;
                splitContainer1.Panel2.Controls.Clear();
                m_userControlFactory = new UserControlFactory(m_user, this);
                initTreeViewButtonPermission();
            }
        }

        public void RefreshUserAndPermission(User user)
        {
            User = user;
        }
        
        private void initTreeViewButtonPermission()
        {
            treeViewMenu.SelectedNode = null;
            treeViewMenu.CollapseAll();
            treeNodeAdmin.Visible = m_user.AdminAccess;//m_user.RoleDetails(UserControlFactory.USER).ViewFlag || m_user.RoleDetails(UserControlFactory.USER_ROLE).ViewFlag;
            treeNodeUser.Visible = m_user.AdminAccess; //m_user.RoleDetails(UserControlFactory.USER).ViewFlag;
            treeNodeUserRole.Visible = false; //m_user.AdminAccess; //m_user.RoleDetails(UserControlFactory.USER_ROLE).ViewFlag;
            treeNodeCrewPayroll.Visible = m_user.CrewPayrollAccess;
            treeNodeDADesk.Visible = m_user.DADeskAccess;
            treeNodeSoftmar.Visible = m_user.SoftmarAccess;
            treeNodeWinSDS.Visible = m_user.WinSDSAccess;
            treeNodeWinSDSPOView.Visible = m_user.AdminAccess;
            treeNodeWinSDSProductMapping.Visible = m_user.WinSDSAccess;
            //other role..................
        }

        private void buttonSignOut_Click(object sender, EventArgs e)
        {
            ShowMainFormPanel(false);
            m_loginForm.InsertlogoutSession();
            m_loginForm.SetMessage("You have successfully signed out of Agresso Interface Monitoring App.");
            m_loginForm.Show();
            m_userControlFactory.ClearUserControls();
            m_user = null;
        }

        private void buttonUserProfile_Click(object sender, EventArgs e)
        {
            UserProfileForm usp = new UserProfileForm(m_user);
            usp.ShowDialog();
        }

        //private ListViewItem CreateListViewLargeItem()
        //{
        //    ListViewItem lvi = new ListViewItem();
        //    lvi.BackColor = System.Drawing.SystemColors.Window;
        //    lvi.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        //    lvi.ForeColor = System.Drawing.SystemColors.WindowText;
        //    System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
        //    lvi.LargeImage = new Gizmox.WebGUI.Common.Resources.ImageResourceHandle(resources.GetString("listViewItemSoftmar.LargeImage"));
        //    lvi.Text = "Softmar";
        //    return lvi;
        //}
    }
}